package com.neouton.crm.pm.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.neouton.common.entity.ActivitiVO;
import com.neouton.common.util.PageUtil;
import com.neouton.crm.entity.FileUploadRecordVO;
import com.neouton.crm.entity.SysUserEntity;
import com.neouton.crm.pm.entity.*;
import com.neouton.crm.sales.entity.SalesAuditVO;
import com.neouton.crm.sales.entity.SalesChangeVO;
import com.neouton.crm.sales.entity.SalesFollowRecordVO;
import com.neouton.crm.sales.entity.SalesStageVO;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

public interface SalesProjectManageService {
    PageUtil<SalesProjectManageVO> queryProject(IPage<SalesProjectManageVO> page, SalesProjectManageVO projectManageVO, List<SysUserEntity> userList, String token);
    PageUtil<SalesProjectManageVO> queryProjectAudit(IPage<SalesProjectManageVO> page, SalesProjectManageVO projectManageVO, List<SysUserEntity> userList, String token);
    List<SalesProjectManageVO> queryProject(SalesProjectManageVO projectManageVO, List<SysUserEntity> userList, String token);
    SalesProjectManageVO queryProjectInfoByOppId(Integer oppId);
    long queryTotal(SalesProjectManageVO projectManageVO, List<SysUserEntity> userList, String token);
    SalesProjectManageVO queryProjectInfoById(Integer projectManageId,String token);
    int addProject(SalesProjectManageVO projectManageVO,String token);
    int updateProject(SalesProjectManageVO projectManageVO,String token);
    List<String> queryFileInfoList(Integer projectManageId);
    void addProjectFileRelation(Integer projectManageId,List<FileUploadRecordVO> fileIds);
    List<SalesChangeVO> queryChangeInfo(Integer projectManageId);
    List<SalesFollowRecordVO> queryFollowRecord(Integer projectManageId);
    int addFollowRecord(SalesFollowRecordVO salesFollowRecordVO);
    int updateFollowRecord(SalesFollowRecordVO salesFollowRecordVO);
    boolean deleteFollowRecords(Integer recordId);
    List<SalesStageVO> queryStageInfo(Integer projectManageId);
    int addStageInfo(SalesStageVO salesStageVO);
    int updateStageInfo(SalesStageVO salesStageVO);
    List<SalesAuditVO> queryAuditInfo(Integer projectManageId);
    int addAuditInfo(SalesAuditVO salesAuditVO);
    int updateAuditInfo(SalesAuditVO salesAuditVO);
    List<Integer> queryProjectOfOpportunity();
    /**
     * 审批通过
     * @param projectManageVO
     * @return
     */
    Boolean approveProjectInfoOne(SalesProjectManageVO projectManageVO, String token, Boolean auto);

    /**
     * 审批驳回
     * @param projectManageVO
     * @return
     */
    Boolean rejectionProjectInfoOne(SalesProjectManageVO projectManageVO,String token);
    /**
     * 审批通过
     * @param projectManageVO
     * @return
     */
    Boolean approveProjectInfo(SalesProjectManageVO projectManageVO, String token, Boolean auto);

    /**
     * 审批驳回
     * @param projectManageVO
     * @return
     */
    Boolean rejectionProjectInfo(SalesProjectManageVO projectManageVO,String token);

    /**
     * 根据工作流ID获取审批信息
     * @param workId
     * @return
     */
    SalesProjectManageVO queryProjectApprovalByWorkId(Integer workId);
    /**
     * 根据工作流ID获取审批信息
     * @param workId
     * @return
     */
    SalesProjectManageVO queryProjectApprovalOneByWorkId(Integer workId,String token);

    SalesProjectManageVO queryHistoryProjectApprovalByApprovalId(Integer workId);

    SalesProjectManageVO queryHistoryProjectApprovalOneByApprovalId(Integer workId,String token);

    PageUtil<SalesProjectManageVO> queryTodoProjectsByPage(IPage<SalesProjectManageVO> page, SalesProjectManageVO projectManageVO);

    /**
     * 通过项目ID获取项目信息
     * @param projectID
     * @return
     */
    SalesProjectManageVO queryProjectByID(Integer projectID);

    /**
     * 获取全部项目信息
     * @return
     */
    List<SalesProjectManageVO> queryProjects(String source);

    boolean changeStage(SalesStageVO salesStageVO);

    /**
     * 根据项目id 获取全部回款计划
     * @param id
     * @return
     */
    List<ContractInfoVO> getProjectAllBackmoneyPlan(Integer id);

    void exportProjectInfo(HttpServletResponse response, List<SalesProjectManageVO> list, String token) throws Exception;

    SalesProjectManageVO queryProjectByPurchaseId(Integer id);

    SysUserEntity queryProjectHeadByProjectId(Integer projectID,String token);

    int transforPrincipal(Integer userId, List<SalesProjectManageVO> voList, String token);

    List<ContractInfoVO>  getProjectAllBackmoneyPlanByCustomerId(Integer customerId);

    ActivitiVO updateManagerSubmit(Integer projectId,ProjectUpdateInfoVO reasonVO, String token);

    Boolean updateManagerApprove(Integer projectId, String token, boolean b);

    Boolean updateManagerReject(Integer projectId, String token);

    List<ProjectUpdateInfoVO> queryUpdateInfoByApproveId(Integer approveId);


    List<ProjectUpdateInfoVO> queryUpdateInfoById(Integer projectManageId);

    List<ProjectUpdateInfoVO> queryUpdateInfoOnLineById(Integer projectManageId);

    void updateFinalBusinessToDB(Integer projectId, String token);

    void updateProjectAfterPass(SalesProjectManageVO projectManageVO, String token);

    SalesProjectManageVO queryProjectByIDFromCache(int projectID, String token);

    void saveUpdateInfoToDBTemp(List<ProjectUpdateInfoVO> projectUpdateInfoVOs, String token);

    void updateStatusAfterSubmit(Integer businessId, Integer projectId, String token);

    List<PurchaseOrderVO> queryPaymentPlanFromCache( List<PurchaseOrderVO> purchaseOrderVOs, String token);

    void deleteUpdateInfoByProjectId(Integer projectId, String token);

    List<ProjectUpdateInfoVO> queryUpdateInfoListBySearch(ProjectUpdateInfoVO projectUpdateInfoVO, String token);

    PageUtil<SalesProjectManageVO> queryUpdateProject(IPage<SalesProjectManageVO> page, SalesProjectManageVO projectManageVO, List<SysUserEntity> userList, String token);

    Integer queryApproveIdByManagerId(Integer projectId, String token);

    Boolean projectStateUpdate(SalesProjectManageVO projectManageVO, String token);

    List<SalesProjectManageVO> queryAllProjectsByUser(String token);

    List<SalesProjectManageVO> queryAllProjects();
}
